/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projectshanghai;

import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

/**
 *
 * @author Eric-Standard
 */
public class MouseMonitor implements MouseListener, MouseMotionListener {

    private boolean[] buttonClicked = new boolean[3];
    private Point point = new Point();

    public boolean[] getButtonClicked() {
        return buttonClicked;
    }

    public boolean getButtonClicked(int button) {
        return buttonClicked[button - MouseEvent.BUTTON1];
    }

    public Point getPoint() {
        return point;
    }

    @Override
    public void mouseClicked(MouseEvent e) {
    }

    @Override
    public void mousePressed(MouseEvent e) {
        switch (e.getButton()) {
            case MouseEvent.BUTTON1:
                buttonClicked[0] = true;
                break;
            case MouseEvent.BUTTON2:
                buttonClicked[1] = true;
                break;
            case MouseEvent.BUTTON3:
                buttonClicked[2] = true;
                break;
        }
    }

    @Override
    public void mouseReleased(MouseEvent e) {
        switch (e.getButton()) {
            case MouseEvent.BUTTON1:
                buttonClicked[0] = false;
                break;
            case MouseEvent.BUTTON2:
                buttonClicked[1] = false;
                break;
            case MouseEvent.BUTTON3:
                buttonClicked[2] = false;
                break;
        }
    }

    @Override
    public void mouseEntered(MouseEvent e) {
    }

    @Override
    public void mouseExited(MouseEvent e) {
    }

    @Override
    public void mouseDragged(MouseEvent e) {
        point = e.getPoint();
    }

    @Override
    public void mouseMoved(MouseEvent e) {
        point = e.getPoint();
    }
}
